package com.gator.feign.client;


import com.gator.feign.client.config.FeignClientConfig;
import com.gator.feign.client.config.FeignClientInterceptorConfig;
import com.gator.feign.client.hystrix.EurekaClientFeignHystrix;
import com.gator.feign.domain.Parent;
import com.gator.feign.domain.Student;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

//eureka-client是访问目标的serviceName
//configuration 针对当前调用目标节点的自定义配置（多个目标节点的策略可能不同，故支持自定义，通过配置引入，更具针对性）
@FeignClient(value = "eureka-client", configuration = {FeignClientConfig.class, FeignClientInterceptorConfig.class},
        fallback = EurekaClientFeignHystrix.class)
public interface EurekaClientFeign {
    /**
     * @Description: 方法名称必须和目标方法名称一致
     * @Author: PABLO
     * @Date: 2022/5/19 23:07
     * @Params: []
     * @Return: java.lang.String
     **/
    @GetMapping(value = "/info")
    String infoByFeign();

    @GetMapping("/getStudent")
    Student getStudentByFeign(@RequestParam("name") String name, @RequestParam("address") String address);

    @PostMapping("/postStudent")
    Student postStudentByFeign(@RequestBody Parent parent);
}
